]> dgit.raspbian.org Git - gnome-shell.git/commit
main: Prepend RPATH or RUNPATH paths to gir search paths
authorJonas Ådahl <jadahl@gmail.com>
Wed, 17 Aug 2022 19:43:21 +0000 (21:43 +0200)
committerJonas Ådahl <jadahl@gmail.com>
Fri, 25 Nov 2022 21:09:37 +0000 (22:09 +0100)
commit9bc89b821cf09195418f20225bbec39c0567d263
tree3742da9f5215ba34fd37f9f2b5340ea730bc87ce
parent1559f03a82317e06aa0596bf12feb8b761a58f52
main: Prepend RPATH or RUNPATH paths to gir search paths

If one wants to run tests the non-installed gnome-shell, that currently
fails as gnome-shell the executable attempts to link against
./build/src/libgnome-shell.so, but when GObject introspection tries to
find what library to link to for Shell, it goes to the installed
libgnome-shell.so, causing two different versions of libgnome-shell.so
to be loaded.

This, however, can be avoided thanks to meson adding $ORIGIN paths to
relevant libraries before installing an executable. What this means in
practice is that we can inspect ourself upon startup, discover whether
the RPATH/RUNPATH header contains $ORIGIN, and if so, expand it to the
directory containing the executable, and prepend the introspection
search paths with said directory.

This effectively means that the introspection machinery now finds the
same library that the linker linked the gnome-shell executable with,
making it run successfully.

It's not possible to use $GI_TYPELIB_PATH since
g_irepository_prepend_library_path() takes precedence. There is no
"append" variant of that API.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
config.h.meson
meson.build
src/main.c